package com.pai4j.common.enums.community;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 *     消息通知内容模版配置枚举
 *
 * @author: CYM-pai
 * @date: 2025/10/27 20:40
 **/
@Getter
public enum  ContentConfigEnum {

    MESSAGE_LIKE_ARTICLE("文章点赞消息", "userName", "articleTitle"),
    MESSAGE_USER_FOCUS("粉丝关注消息", "userName"),
    MESSAGE_BBS_COMMENT("动态评论消息", "userName", "bbsContent"),
    MESSAGE_BBS_COMMENT_REPLY("动态下评论回复消息", "userName", "bbsContent", "commentContent"),
    INTEGRAL_UPDATE_NOTIFY("积分变化通知", "content"),
    RESOURCE_REVIEW_NOTIFY("资源审核结果通知", "content"),
    RESOURCE_REVIEW_WORK_ORDER_NOTIFY("资源审核工单", "content"),
    NAV_REVIEW_WORK_ORDER_NOTIFY("导航资源审核审核工单", "content"),
    MEDAL_AWARD_NOTIFY("徽章授予通知", "medalType", "medalName");

    /***
     * 模板名称
     */
    private String configName;

    /***
     * 替换的变量名
     */
    private String[] vars;

    ContentConfigEnum(String configName, String ... vars) {
        this.configName = configName;
        this.vars = vars;
    }

    public static String[] getVars(String code) {
        String[] vars = new String[0];
        if (StringUtils.isBlank(code)) {
            return vars;
        }
        for (ContentConfigEnum config : ContentConfigEnum.values()) {
            if (config.name().equals(code)) {
                return config.vars;
            }
        }
        return vars;
    }
}
